package com.teachoa.bean;

import com.jfinal.plugin.activerecord.Model;
import com.teachoa.enumtype.UserTypeEnum;
import com.teachoa.util.IDUtil;
import com.teachoa.util.Maps;

@SuppressWarnings("unchecked")
public class RoleMenu extends Model<RoleMenu> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4837140359470381170L;
	
	public static final RoleMenu dao = new RoleMenu();
	
	public void createRoleMenu() {
		String zxId = Menu.dao.findByName("项目咨询管理").getStr("id");
		String projectId = Menu.dao.findByName("项目管理").getStr("id");
		//String teachId = Menu.dao.findByName("教师学生管理").getStr("id");
		String publishId = Menu.dao.findByName("项目信息发布管理").getStr("id");
		dao.setAttrs(Maps.newHashMap("id", IDUtil.getId(), "menu_id", zxId, "type", UserTypeEnum.STUDENT.getCode()));
		dao.save();
		dao.setAttrs(Maps.newHashMap("id", IDUtil.getId(), "menu_id", zxId, "type", UserTypeEnum.EXPERT.getCode()));
		dao.save();
		dao.setAttrs(Maps.newHashMap("id", IDUtil.getId(), "menu_id", projectId, "type", UserTypeEnum.STUDENT.getCode()));
		dao.save();
		dao.setAttrs(Maps.newHashMap("id", IDUtil.getId(), "menu_id", projectId, "type", UserTypeEnum.EXPERT.getCode()));
		dao.save();
		dao.setAttrs(Maps.newHashMap("id", IDUtil.getId(), "menu_id", projectId, "type", UserTypeEnum.TEACHER.getCode()));
		dao.save();
		/*dao.setAttrs(Maps.newHashMap("id", IDUtil.getId(), "menu_id", teachId, "type", UserTypeEnum.ADMIN.getCode()));
		dao.save();*/
		dao.setAttrs(Maps.newHashMap("id", IDUtil.getId(), "menu_id", publishId, "type", UserTypeEnum.TEACHER.getCode()));
		dao.save();
		
	}

}
